<?php

require_module_config('framework.yui');
require_library('framework.scgi');

class cls_yui
{
    public static function compress_js($string)
    {
        $params = array(
            'type' => 'js'
        );
        $result = cls_scgi::request($GLOBALS['yui_module_settings']['url'], $params, $string);
        if ($result{0} != '0')
        {
            throw new cls_exception("X-peer exception occured: $result");
        }

        return substr($result, 1);
    }

    public static function compress_css($string)
    {
        $params = array(
            'type' => 'css'
        );
        $result = cls_scgi::request($GLOBALS['yui_module_settings']['url'], $params, $string);
        if ($result{0} != '0')
        {
            throw new cls_exception("X-peer exception occured: $result");
        }

        return substr($result, 1);
    }
}

?>